﻿using System.Net;
using System;

namespace ConsulTest
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var consul = new Consul.ConsulClient(c =>
            {
                c.Address = new System.Uri("http://192.168.137.200:8500");
            }))
            {
                var services = consul.Agent.Services().Result.Response;
                foreach (var s in services.Values)
                {
                  //  Console.WriteLine($"{item.Address}:{item.Port}");
                    Console.WriteLine($"ID={s.ID},Service={s.Service},Addr={s.Address},Port={s.Port}");
                }

            }
            Console.ReadLine();
          
        }
    }
}
